package com.cloud.pay.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloud.pay.dao.PaymentDao;
import com.cloud.pay.entity.Payment;
import com.cloud.pay.service.PaymentService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 支付订单表 服务实现类
 * </p>
 *
 * @author wenjin
 * @since 2019-12-11
 */
@Service
public class PaymentServiceImpl extends ServiceImpl<PaymentDao, Payment> implements PaymentService {

    @Override
    public Payment getByTradeNo(String appId, String tradeNo) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq(Payment.APP_ID, appId);
        queryWrapper.eq(Payment.TRADE_NO, tradeNo);
        return getOne(queryWrapper);
    }

    @Override
    public Payment getByOrderNo(String appId, String orderNo) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq(Payment.APP_ID, appId);
        queryWrapper.eq(Payment.ORDER_NO, orderNo);
        return getOne(queryWrapper);
    }
}
